<template>
  <div class="title">
    <h2>当前求和为: {{ sum }}</h2>
    <h2>当前通过复杂运算求和: {{ bigSum }}</h2>
    <h3>下方组件的总人数：{{personList.length}}</h3>
	<br>
    <select v-model.number="n">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
	</select>
    <button @click="jia(n)">+</button>
    <button @click="jian(n)">-</button>
    <button @click="ji(n)">当前和为奇数再加</button>
    <button @click="slide(n)">等一等再加</button>
    <Student />
  </div>
</template>

<script>
import Student from './components/Student'
import {mapState,mapGetters,mapMutations,mapActions} from 'vuex'

export default {
  name: 'App',
  components:{Student},
  data() {
    return {
      n: 1 //用户选择数字
    }
  },
  computed:{
	...mapState('countOptions',['sum']),
	...mapState('personOptions',['personList']),
	...mapGetters('countOptions',['bigSum'])
  },
  methods: {
    ...mapMutations('countOptions',{jia:'JIA',jian:'JIAN'}),
    ...mapActions('countOptions',{ji:'ji',slide:'slide'})
  }
}
</script>

